from page.login_page import LoginPage
from tools.utils import chrome

def cookie_get():
    driver = chrome()
    name = "admin"
    password = "123456"
    lp = LoginPage(driver)
    lp.login(name, password)

    # 获取cookie
    cookies = driver.get_cookies()
    ck = {'name': 'PHPSESSID', 'value': ''}
    for cookie in cookies:
        if cookie['name'] == 'PHPSESSID':
            ck['value'] = cookie['value']
            break
    return ck